package com.xueyi.aixihu.controller;

import com.xueyi.aixihu.controller.base.BaseController;
import com.xueyi.aixihu.entity.vo.DataList;
import com.xueyi.aixihu.entity.vo.WaitAuditNewsVo;
import com.xueyi.aixihu.exception.SzException;
import com.xueyi.aixihu.reqeust.AuditNewsReq;
import com.xueyi.aixihu.reqeust.FindWaitAuditNewsListReq;
import com.xueyi.aixihu.reqeust.OpenNewsReq;
import com.xueyi.aixihu.response.base.BaseResponse;
import com.xueyi.aixihu.service.NewAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hxs
 * @createDate 2023/6/28 10:04
 * @description 文章审核接口
 */
@RestController
public class NewAuditController extends BaseController {
    @Autowired
    private NewAuditService newAuditService;

//    /**
//     * 查询待审核列表
//     *
//     * @return 文章列表
//     */
//    @RequestMapping("/audit/news/findWaitAuditNewsList")
//    public BaseResponse<DataList<WaitAuditNewsVo>> findWaitAuditNewsList(@Validated FindWaitAuditNewsListReq findWaitAuditNewsListReq) {
//        DataList<WaitAuditNewsVo> flag = newAuditService.findWaitAuditNewsList(findWaitAuditNewsListReq);
//        return BaseResponse.success(flag);
//    }

    /**
     * 审核镇级党务公开
     *
     * @param auditNewsReq
     * @return
     */
    @RequestMapping("/audit/news/auditNewsByZJDW")
    public BaseResponse<Boolean> auditNewsByZJDW(@Validated AuditNewsReq auditNewsReq) throws SzException {
        newAuditService.auditNewsByZJDW(auditNewsReq);
        return BaseResponse.success(Boolean.TRUE);
    }

    /**
     * 是否公开镇级党务公开
     *
     * @param openNewsReq
     * @return
     * @throws SzException
     */
    @RequestMapping("/audit/news/openNewsByZJDW")
    public BaseResponse<Boolean> openNewsByZJDW(@Validated OpenNewsReq openNewsReq) throws SzException {
        newAuditService.openNewsByZJDW(openNewsReq);
        return BaseResponse.success(Boolean.TRUE);
    }

    /**
     * 是否公开镇级政务公开
     *
     * @param openNewsReq
     * @return
     * @throws SzException
     */
    @RequestMapping("/audit/news/openNewsByZJZW")
    public BaseResponse<Boolean> openNewsByZJZW(@Validated OpenNewsReq openNewsReq) throws SzException {
        newAuditService.openNewsByZJZW(openNewsReq);
        return BaseResponse.success(Boolean.TRUE);
    }

    /**
     * 审核镇级政务公开
     *
     * @param auditNewsReq
     * @return
     */
    @RequestMapping("/audit/news/auditNewsByZJZW")
    public BaseResponse<Boolean> auditNewsByZJZW(@Validated AuditNewsReq auditNewsReq) throws SzException {
        newAuditService.auditNewsByZJZW(auditNewsReq);
        return BaseResponse.success(Boolean.TRUE);
    }
}
